/**
 * 
 */
Rsd.createApplication({
        appTitle:'南京红微信息科技有限公司',
        appFolder: '',
        appHost:'',
        isDebug:false,
        appVersion:'1.0.0.1',
        appDate:new Date().getTime(),//开发时使用
        //appDate:new Date('2018-08-07').getTime(),
        isDemo:false,
        isDesign:true,//应用处于页面设计状态
        imgHost:'http://image.redmicro.cn/',
        requires:[],
        beforeRun:function beforeRun() {

            Rsd.onResize(function () {
                Rsd.defineRem(Rsd.isMobile()?640:800);
            });
        },
        /**
         * 
         */
        launch: function launch() {

            var _title = Rsd.getUrlParam('title')||Rsd.app.appTitle;
            var _spm = Rsd.getUrlParam('spm')||'';//Site Promotion Management（网站推广管理）
            var str = Rsd.getUrlParam('view')||'Home';
            str = str.toLowerCase();
            var arr = str.split('.');//分割单词
            arr = arr.map(item=>{
                //首字母大写
                return  item.replace(/\b\w+\b/g, function(word){
                            return word.substring(0,1).toUpperCase()+word.substring(1);
                        });
            });
          
            var _tpl = arr.join('');
            //console.log(_tpl);
            var _class = 'Rsd.hermit.pages.'+_tpl + 'Page';
            //console.log(_class);
            var page = Rsd.create(_class, {
                header:false,
                spm:_spm,
            });
            if(page == null)
            {
                console.error('未找到页面'+_class+',页面匹配规则为：以.分割单词且首字母大写');
            }
            document.title = page.title || _title;
            this.currentPage = page; 
            page.show(); 
        },
        /**
         * 
         */
        goto:function goto(page,args)
        {
            window.location.href =  window.location.origin  + window.location.pathname + '?view='+(page||'home')+'&' + (args||'');
        }
    }
);